<?php
/**
 * Created by PhpStorm.
 * User: idcu
 * Date: 2016/3/9
 * Time: 19:31
 */
namespace Crm\Model;
use IDCU\Model\RelationModel;

class UserModel extends RelationModel
{
//    protected $tableName = 'user';

    protected $_link = array(
        'Role' => array(
            'mapping_type'          => self::MANY_TO_MANY,
            'class_name'            => 'Role',
            'mapping_name'          => 'role',
            'foreign_key'           => 'user_id',
            'relation_foreign_key'  => 'role_id',
            'relation_table'        => 'zh_role_user',
        ),
        'OaUser' => array(
            'mapping_type'          => self::HAS_MANY,
            'class_name'            => 'OaUser',
            'mapping_name'          => 'oaUser',
            'foreign_key'           => 'crm_id',
        )
    );
}